package fengcan;

import java.awt.Container;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;

import utils.Util;
import window.About;
import window.SplashScreen;

public class TestWindowsRun extends JFrame{
	
		  private ClassLoader cl = getClass().getClassLoader();
		  public ImageIcon logo = new ImageIcon(this.cl.getResource("icons/logo.gif"));
		  public ImageIcon ball = new ImageIcon(this.cl.getResource("icons/ball.gif"));
		  private JTabbedPane tabbedPane;

		  public TestWindowsRun()
		  {
		    Container localContainer = getContentPane();
		    this.tabbedPane = new JTabbedPane(1);
//		    SocketTestClient localSocketTestClient = new SocketTestClient(this);
//		    SocketTestServer localSocketTestServer = new SocketTestServer(this);
//		    SocketTestUdp localSocketTestUdp = new SocketTestUdp(this);
		    About localAbout = new About();
//		    this.tabbedPane.addTab("Client", this.ball, localSocketTestClient, "Test any server");
//		    this.tabbedPane.addTab("Server", this.ball, localSocketTestServer, "Test any client");
//		    this.tabbedPane.addTab("Udp", this.ball, localSocketTestUdp, "Test any UDP Client or Server");
		    this.tabbedPane.addTab("About", this.ball, localAbout, "About SocketTest");
		    this.tabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		    localContainer.add(this.tabbedPane);
		  }

		  public static void main(String[] paramArrayOfString)
		  {
		    try
		    {
		      UIManager.setLookAndFeel("net.sourceforge.mlf.metouia.MetouiaLookAndFeel");
		    }
		    catch (Exception localException1)
		    {
		      try
		      {
		        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		      }
		      catch (Exception localException2)
		      {
		        System.out.println("Error setting native LAF: " + localException2);
		      }
		    }
		    int i = 1;
		    if ((paramArrayOfString.length > 0) && ("nosplash".equals(paramArrayOfString[0]))) {
		    	i = 0;
		    }
		      
		    SplashScreen localSplashScreen = null;
		    if (i != 0) {
		    	localSplashScreen = new SplashScreen();
		    }
		      
		    TestWindowsRun localSocketTest = new TestWindowsRun();
		    localSocketTest.setTitle("SocketTest v 3.0.0");
		    localSocketTest.setSize(600, 500);
		    Util.centerWindow(localSocketTest);
		    localSocketTest.setDefaultCloseOperation(3);
		    localSocketTest.setIconImage(localSocketTest.logo.getImage());
		    if (i != 0)
		      localSplashScreen.kill();
		    localSocketTest.setVisible(true);
		  }
}
